import { pget, ppostJson } from '@/utils/req'
import { modalApi } from '@/utils/modalReq'

// 获取指定部门列表
export function getOnlydept(query: { merchantId?: string | number }) {
	return pget(`${modalApi.system}/common/department/list`, query)
}

// 获取公司
export function getCompany(query?: any) {
	return pget(`${modalApi.system}/common/merchant/list`, query)
}
// 获取登录账户上级公司以及所有下级公司列表
export function getSupAndSubCompany() {
	return pget(`${modalApi.system}/login-user/merchant/sup-and-sub`)
}
// 获取公司的城市
export function getCompanyCity(query: any) {
	return pget(`${modalApi.system}/merchant/city/list`, query)
}

/** 通用获取公司的城市 */
export function getCommonCompanyCity(query: any) {
	return pget(`${modalApi.system}/common/merchant/city/list`, query)
}
// 获取城市
export function getAllCitys(query?: any) {
	return pget(
		`${modalApi.common}/shopec-systembase/basecity/getBaseCitys`,
		query,
	)
}
// 获取城市带权限
export function getAllCitysPermission(query?: any) {
	return pget(
		`${modalApi.common}/shopec-systembase/basecity/getBaseCitysForPermission`,
		query,
	)
}
// 获取省份数据
export function getProvinceDataByCityName(query?: any) {
	return pget(
		`${modalApi.common}/shopec-systembase/basecity/getProvinceDataByCityName`,
		query,
	)
}
// 生成随机编号
export function getGenerateNumber(prefix: string) {
	return pget(
		`${modalApi.supplier}/supplier/currency/getGenerateNumber?prefix=${prefix}`,
	)
}
// 通用获取用户名称
export function getUserNameList(data: any) {
	return ppostJson(`${modalApi.system}/common/user-simple/list`, data)
}

/** 盘点模块使用-分页-查询用户信息列表 */
export function getOrgUserList(data: any) {
	return ppostJson(`${modalApi.system}/common/org-user-list/page`, data)
}

/** 工作流准入审批 */
export function completeTask(data: any) {
	return ppostJson(`${modalApi.workflow}/process/completeTask`, data)
}
/** 拾取任务审批 */
export function claimTaskCandidate(data: any) {
	return ppostJson(`${modalApi.workflow}/process/claimTaskCandidate`, data)
}
/** 历史审批记录 */
export function historyList(data: any) {
	return ppostJson(`${modalApi.workflow}/process/historyList`, data)
}
/** 审批拒绝 */
export function deleteProcessInstance(data: any) {
	return ppostJson(`${modalApi.workflow}/process/deleteProcessInstance`, data)
}

// 获取持有方
export function getHolderDictInfo(query: any) {
	return pget(
		`${modalApi.carMessage}/vehicle/getDictInfo`,
		query,
	)
}
// 获取历史记录
export function getOperatelogList(query: any) {
	return pget(
		`${modalApi.common}/operatelog/list`,
		query,
	)
}

/** 新增作废流程 */
export function processRecordSave(data: any) {
	return ppostJson(`${modalApi.common}/shopec-process-record/processrecord/save`, data)
}
/** 获取作废流程数据list */
export function historicalFlowList(data: any) {
	return ppostJson(`${modalApi.common}/shopec-process-record/processrecord/historicalFlowList`, data)
}
